Skip to content

New - Allow user-provided sampler and add out of the box CEL sampler support#473

Open
cleverchuk wants to merge 1 commit into
mainfrom
cc/NH-132097
Open

New - Allow user-provided sampler and add out of the box CEL sampler support#473
cleverchuk wants to merge 1 commit into
mainfrom
cc/NH-132097

Conversation

@cleverchuk
Copy link
Copy Markdown
Contributor

Summary

Allow users to provide their own sampler (e.g., CEL sampler) instead of forcing the SolarwindsSampler. Remove the JDK version check in the Lambda extension. Fix duplicate META-INF license file warnings in shadow JARs.

Details

User-provided sampler support

Previously, the AgentListener implementations (SolarwindsAgentListener, LambdaAgentListener) checked at startup whether the configured sampler was an instance of SolarwindsSampler. If not, they disabled the agent entirely and shut down the SDK. This prevented users from using alternative samplers (like the OpenTelemetry CEL sampler) while still benefiting from the rest of the SolarWinds extensions (exporters, propagators, span processors).

This change removes the isUsingSolarwindsSampler runtime check and the setAgentEnabled method that allowed it to ratchet the agent off. The agent now starts its background tasks (settings reader, HTTP settings delegate, shutdown hooks) whenever isAgentEnabled() is true, regardless of which sampler is in use.

On the declarative configuration side, SharedConfigCustomizerProvider.addSampler() now checks whether a sampler is already configured before injecting the default SolarwindsSampler. If the user has declared a sampler in their config file, it is preserved.

The opentelemetry-cel-sampler contrib library is added as a dependency so users can configure CEL-based sampling rules directly in their OpenTelemetry config file without writing a custom extension.

JDK version check removal in Lambda

The Lambda configuration provider previously gated initialization on JavaRuntimeVersionChecker.isJdkVersionSupported(). This check is no longer needed because AWS Lambda runtimes guarantee a supported JDK version. Removing it simplifies the startup path and eliminates a dependency on the version checker in the Lambda module.

META-INF duplicate file fix

Shadow/fat JAR tasks in agent, agent-lambda, and testing/agent-for-testing now use DuplicatesStrategy.EXCLUDE for META-INF/LICENSE* and META-INF/NOTICE* files to suppress build warnings from multiple dependencies bundling the same license files.

Test services data

  1. e-1712644058766987264
  2. e-1712643928659124224
  3. e-1742334541200846848
  4. e-1777406072376840192

Copilot AI review requested due to automatic review settings April 28, 2026 18:35
@cleverchuk cleverchuk requested review from a team as code owners April 28, 2026 18:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SolarWinds OpenTelemetry distro so users can configure a non-default sampler (including the OpenTelemetry CEL sampler) without the agent disabling itself, and reduces build/startup friction in Lambda and Shadow JAR packaging.

Changes:

  • Stop disabling the agent when the configured sampler is not SolarwindsSampler; only inject the default sampler when none is configured.
  • Add opentelemetry-cel-sampler dependency to support CEL sampler configuration out-of-the-box.
  • Remove the Lambda JDK version gating and suppress ShadowJar duplicate LICENSE/NOTICE warnings.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/SharedConfigCustomizerProvider.java Only adds the default sampler when no sampler is configured.
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/SharedConfigCustomizerProviderTest.java Adds coverage ensuring user-provided sampler config isn’t overridden.
libs/shared/build.gradle.kts Adds CEL sampler dependency (with exclusions).
dependencyManagement/build.gradle.kts Adds managed dependency entry for CEL sampler.
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/AutoConfigurationCustomizerProviderImpl.java Removes the “ratchet off” setAgentEnabled API.
custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsAgentListener.java Removes sampler-type enforcement and always runs startup tasks when enabled.
custom/src/test/java/com/solarwinds/opentelemetry/extensions/provider/AutoConfigurationCustomizerProviderImplTest.java Updates tests for removal of setAgentEnabled.
custom/src/test/java/com/solarwinds/opentelemetry/extensions/SolarwindsAgentListenerTest.java Updates tests to validate shutdown behavior based on isAgentEnabled().
libs/lambda/src/main/java/com/solarwinds/opentelemetry/extensions/DefaultAutoConfigurationCustomizerProvider.java Removes Lambda JDK version check; defaults agent enabled unless config load fails.
libs/lambda/src/main/java/com/solarwinds/opentelemetry/extensions/LambdaAgentListener.java Removes sampler-type enforcement in Lambda listener.
libs/lambda/src/test/java/com/solarwinds/opentelemetry/extensions/LambdaAgentListenerTest.java Updates tests for new enable/disable behavior.
agent/build.gradle.kts Excludes duplicate LICENSE/NOTICE files during Shadow relocation step.
agent-lambda/build.gradle.kts Same Shadow duplicate LICENSE/NOTICE exclusion for Lambda agent build.
testing/agent-for-testing/build.gradle.kts Same Shadow duplicate LICENSE/NOTICE exclusion for test agent build.

Comment thread agent/build.gradle.kts
Comment thread agent-lambda/build.gradle.kts
Comment thread testing/agent-for-testing/build.gradle.kts
…/o extension and removed JDK version check in lambda.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

This PR has been automatically marked as stale because it has not had any activity in the last 7 days. It will be closed in 7 days if no further activity occurs.

@github-actions github-actions Bot added the stale label May 6, 2026
@cheempz cheempz removed the stale label May 6, 2026
Copy link
Copy Markdown
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants